import React, { useEffect, useState } from 'react'

import { BrowserRouter as Router,Link,Route ,NavLink,Switch} from "react-router-dom";
import "./index.css";
import Article from './pages/Article';

export default function App() {
  return (
   <>
    <Router>
    {/* <a href="#/home">Home</a> */}
      {/* 如果是‘/’，一定要加exact，不然每个navlink都能匹配到 */}
        <NavLink   to='/article/1' >article1</NavLink>
        <NavLink   to='/article/2' >article2</NavLink>
        <NavLink   to='/article/3' >article3</NavLink>
      <div>
        <hr />
      </div>
      {/* {hash==='#/comment'&&<Comment></Comment> */}
      {/* 如果是‘/’，一定要加exact，不然每个route都会渲染 */}
      <Switch>
        <Route  path='/article/:id' component={Article}></Route>
      </Switch>
    </Router>
   </>
  )
}
